import { Token } from '@/types/data'
import { RootAction } from '@/types/store'
import { getToken } from '@/utils/token'

// 这里处理登录相关的数据
const initState = getToken()

export default function loginReducer(
  state: Token = initState,
  action: RootAction
) {
  if (action.type === 'login/login') {
    return action.payload
  }

  return state
}
